
const { Controller } = require('egg');


class PokmonController extends Controller {
  // 获取所有宝可梦
  async getPokemonPage() {
    const { ctx } = this;
    const info = ctx.request.query;
    await ctx.service.pokemon.getPage(info,ctx);
  }
  // 获取指定宝可梦
  async getPokemon() {
    const { ctx } = this;
    const info = ctx.request.query;
    await ctx.service.pokemon.getPokemon(info,ctx);
  }
  // 添加宝可梦
  async addPokemon() {
    const { ctx } = this;
    const info = ctx.request.body;
    const file = ctx.request.files[0];
    await ctx.service.pokemon.add(info,file,ctx);
  }
   // 更新宝可梦
   async updatePokemon() {
    const { ctx } = this;
    const info = ctx.request.body;
    const file = ctx.request.files[0];
    await ctx.service.pokemon.update(info,file,ctx);
  }
  // 删除宝可梦
  async deletePokemon(){
    const { ctx } = this;
    const info = ctx.request.body;
    await ctx.service.pokemon.delete(info,ctx);
  }
}

module.exports = PokmonController;
